﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Xml.Linq;
using HslCommunication.Core.Net;
using HslCommunication.Reflection;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace HslCommunication.Robot.ABB
{
	/// <summary>
	/// ABB机器人的web api接口的客户端，可以方便快速的获取到abb机器人的一些数据信息<br />
	/// The client of ABB robot's web API interface can easily and quickly obtain some data information of ABB robot
	/// </summary>
	/// <remarks>
	/// 参考的界面信息是：http://developercenter.robotstudio.com/webservice/api_reference
	///
	/// 关于额外的地址说明，如果想要查看，可以调用<see cref="M:HslCommunication.Robot.ABB.ABBWebApiClient.GetSelectStrings" /> 返回字符串列表来看看。
	/// </remarks>
	// Token: 0x0200003C RID: 60
	public class ABBWebApiClient : NetworkWebApiBase, IRobotNet
	{
		/// <summary>
		/// 使用指定的ip地址来初始化对象<br />
		/// Initializes the object using the specified IP address
		/// </summary>
		/// <param name="ipAddress">Ip地址信息</param>
		// Token: 0x060004F3 RID: 1267 RVA: 0x00013E89 File Offset: 0x00012089
		public ABBWebApiClient(string ipAddress) : base(ipAddress)
		{
		}

		/// <summary>
		/// 使用指定的ip地址和端口号来初始化对象<br />
		/// Initializes the object with the specified IP address and port number
		/// </summary>
		/// <param name="ipAddress">Ip地址信息</param>
		/// <param name="port">端口号信息</param>
		// Token: 0x060004F4 RID: 1268 RVA: 0x00013E94 File Offset: 0x00012094
		public ABBWebApiClient(string ipAddress, int port) : base(ipAddress, port)
		{
		}

		/// <summary>
		/// 使用指定的ip地址，端口号，用户名，密码来初始化对象<br />
		/// Initialize the object with the specified IP address, port number, username, and password
		/// </summary>
		/// <param name="ipAddress">Ip地址信息</param>
		/// <param name="port">端口号信息</param>
		/// <param name="name">用户名</param>
		/// <param name="password">密码</param>
		// Token: 0x060004F5 RID: 1269 RVA: 0x00013EA0 File Offset: 0x000120A0
		public ABBWebApiClient(string ipAddress, int port, string name, string password) : base(ipAddress, port, name, password)
		{
		}

		/// <inheritdoc />
		// Token: 0x060004F6 RID: 1270 RVA: 0x00013EB0 File Offset: 0x000120B0
		[HslMqttApi(ApiTopic = "ReadRobotByte", Description = "Read the other side of the data information, usually designed for the GET method information.If you start with url=, you are using native address access")]
		public override OperateResult<byte[]> Read(string address)
		{
			return base.Read(address);
		}

		/// <inheritdoc />
		// Token: 0x060004F7 RID: 1271 RVA: 0x00013ECC File Offset: 0x000120CC
		[HslMqttApi(ApiTopic = "ReadRobotString", Description = "The string data information that reads the other party information, usually designed for the GET method information.If you start with url=, you are using native address access")]
		public override OperateResult<string> ReadString(string address)
		{
			return base.ReadString(address);
		}

		/// <inheritdoc />
		// Token: 0x060004F8 RID: 1272 RVA: 0x00013EE8 File Offset: 0x000120E8
		[HslMqttApi(ApiTopic = "WriteRobotByte", Description = "Using POST to request data information from the other party, we need to start with url= to indicate that we are using native address access")]
		public override OperateResult Write(string address, byte[] value)
		{
			return base.Write(address, value);
		}

		/// <inheritdoc />
		// Token: 0x060004F9 RID: 1273 RVA: 0x00013F04 File Offset: 0x00012104
		[HslMqttApi(ApiTopic = "WriteRobotString", Description = "Using POST to request data information from the other party, we need to start with url= to indicate that we are using native address access")]
		public override OperateResult Write(string address, string value)
		{
			return base.Write(address, value);
		}

		/// <inheritdoc />
		// Token: 0x060004FA RID: 1274 RVA: 0x00013F20 File Offset: 0x00012120
		protected override OperateResult<string> ReadByAddress(string address)
		{
			bool flag = address.ToUpper() == "ErrorState".ToUpper();
			OperateResult<string> result;
			if (flag)
			{
				result = this.GetErrorState();
			}
			else
			{
				bool flag2 = address.ToUpper() == "jointtarget".ToUpper();
				if (flag2)
				{
					result = this.GetJointTarget();
				}
				else
				{
					bool flag3 = address.ToUpper() == "PhysicalJoints".ToUpper();
					if (flag3)
					{
						result = this.GetJointTarget();
					}
					else
					{
						bool flag4 = address.ToUpper() == "SpeedRatio".ToUpper();
						if (flag4)
						{
							result = this.GetSpeedRatio();
						}
						else
						{
							bool flag5 = address.ToUpper() == "OperationMode".ToUpper();
							if (flag5)
							{
								result = this.GetOperationMode();
							}
							else
							{
								bool flag6 = address.ToUpper() == "CtrlState".ToUpper();
								if (flag6)
								{
									result = this.GetCtrlState();
								}
								else
								{
									bool flag7 = address.ToUpper() == "ioin".ToUpper();
									if (flag7)
									{
										result = this.GetIOIn();
									}
									else
									{
										bool flag8 = address.ToUpper() == "ioout".ToUpper();
										if (flag8)
										{
											result = this.GetIOOut();
										}
										else
										{
											bool flag9 = address.ToUpper() == "io2in".ToUpper();
											if (flag9)
											{
												result = this.GetIO2In();
											}
											else
											{
												bool flag10 = address.ToUpper() == "io2out".ToUpper();
												if (flag10)
												{
													result = this.GetIO2Out();
												}
												else
												{
													bool flag11 = address.ToUpper().StartsWith("log".ToUpper());
													if (flag11)
													{
														bool flag12 = address.Length > 3;
														if (flag12)
														{
															int logCount;
															bool flag13 = int.TryParse(address.Substring(3), out logCount);
															if (flag13)
															{
																return this.GetLog(logCount);
															}
														}
														result = this.GetLog(10);
													}
													else
													{
														bool flag14 = address.ToUpper() == "system".ToUpper();
														if (flag14)
														{
															result = this.GetSystem();
														}
														else
														{
															bool flag15 = address.ToUpper() == "robtarget".ToUpper();
															if (flag15)
															{
																result = this.GetRobotTarget();
															}
															else
															{
																bool flag16 = address.ToUpper() == "ServoEnable".ToUpper();
																if (flag16)
																{
																	result = this.GetServoEnable();
																}
																else
																{
																	bool flag17 = address.ToUpper() == "RapidExecution".ToUpper();
																	if (flag17)
																	{
																		result = this.GetRapidExecution();
																	}
																	else
																	{
																		bool flag18 = address.ToUpper() == "RapidTasks".ToUpper();
																		if (flag18)
																		{
																			result = this.GetRapidTasks();
																		}
																		else
																		{
																			result = base.ReadByAddress(address);
																		}
																	}
																}
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
			return result;
		}

		/// <inheritdoc />
		// Token: 0x060004FB RID: 1275 RVA: 0x000141D0 File Offset: 0x000123D0
		[DebuggerStepThrough]
		protected override Task<OperateResult<string>> ReadByAddressAsync(string address)
		{
			ABBWebApiClient.<ReadByAddressAsync>d__8 <ReadByAddressAsync>d__ = new ABBWebApiClient.<ReadByAddressAsync>d__8();
			<ReadByAddressAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string>>.Create();
			<ReadByAddressAsync>d__.<>4__this = this;
			<ReadByAddressAsync>d__.address = address;
			<ReadByAddressAsync>d__.<>1__state = -1;
			<ReadByAddressAsync>d__.<>t__builder.Start<ABBWebApiClient.<ReadByAddressAsync>d__8>(ref <ReadByAddressAsync>d__);
			return <ReadByAddressAsync>d__.<>t__builder.Task;
		}

		/// <summary>
		/// 获取当前支持的读取的地址列表<br />
		/// Gets a list of addresses for currently supported reads
		/// </summary>
		/// <returns>数组信息</returns>
		// Token: 0x060004FC RID: 1276 RVA: 0x0001421C File Offset: 0x0001241C
		public static List<string> GetSelectStrings()
		{
			return new List<string>
			{
				"ErrorState",
				"jointtarget",
				"PhysicalJoints",
				"SpeedRatio",
				"OperationMode",
				"CtrlState",
				"ioin",
				"ioout",
				"io2in",
				"io2out",
				"log",
				"system",
				"robtarget",
				"ServoEnable",
				"RapidExecution",
				"RapidTasks"
			};
		}

		// Token: 0x060004FD RID: 1277 RVA: 0x000142F4 File Offset: 0x000124F4
		private OperateResult<string> AnalysisClassAttribute(string content, string[] atts)
		{
			JObject jobject = new JObject();
			for (int i = 0; i < atts.Length; i++)
			{
				Match match = Regex.Match(content, "<span class=\"" + atts[i] + "\">[^<]*");
				bool flag = !match.Success;
				if (flag)
				{
					return new OperateResult<string>(content);
				}
				jobject.Add(atts[i], new JValue(match.Value.Substring(15 + atts[i].Length)));
			}
			return OperateResult.CreateSuccessResult<string>(jobject.ToString());
		}

		// Token: 0x060004FE RID: 1278 RVA: 0x00014384 File Offset: 0x00012584
		private OperateResult<string> AnalysisSystem(string content)
		{
			return this.AnalysisClassAttribute(content, new string[]
			{
				"major",
				"minor",
				"build",
				"title",
				"type",
				"description",
				"date",
				"mctimestamp",
				"name",
				"sysid",
				"starttm"
			});
		}

		// Token: 0x060004FF RID: 1279 RVA: 0x00014400 File Offset: 0x00012600
		private OperateResult<string> AnalysisRobotTarget(string content)
		{
			return this.AnalysisClassAttribute(content, new string[]
			{
				"x",
				"y",
				"z",
				"q1",
				"q2",
				"q3"
			});
		}

		/// <summary>
		/// 获取当前的控制状态，Content属性就是机器人的控制信息<br />
		/// Get the current control state. The Content attribute is the control information of the robot
		/// </summary>
		/// <returns>带有状态信息的结果类对象</returns>
		// Token: 0x06000500 RID: 1280 RVA: 0x00014450 File Offset: 0x00012650
		[HslMqttApi(Description = "Get the current control state. The Content attribute is the control information of the robot")]
		public OperateResult<string> GetCtrlState()
		{
			OperateResult<string> operateResult = this.ReadString("url=/rw/panel/ctrlstate");
			bool flag = !operateResult.IsSuccess;
			OperateResult<string> result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				Match match = Regex.Match(operateResult.Content, "<span class=\"ctrlstate\">[^<]+");
				bool flag2 = !match.Success;
				if (flag2)
				{
					result = new OperateResult<string>(operateResult.Content);
				}
				else
				{
					result = OperateResult.CreateSuccessResult<string>(match.Value.Substring(24));
				}
			}
			return result;
		}

		/// <summary>
		/// 获取当前的错误状态，Content属性就是机器人的状态信息<br />
		/// Gets the current error state. The Content attribute is the state information of the robot
		/// </summary>
		/// <returns>带有状态信息的结果类对象</returns>
		// Token: 0x06000501 RID: 1281 RVA: 0x000144C0 File Offset: 0x000126C0
		[HslMqttApi(Description = "Gets the current error state. The Content attribute is the state information of the robot")]
		public OperateResult<string> GetErrorState()
		{
			OperateResult<string> operateResult = this.ReadString("url=/rw/motionsystem/errorstate");
			bool flag = !operateResult.IsSuccess;
			OperateResult<string> result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				Match match = Regex.Match(operateResult.Content, "<span class=\"err-state\">[^<]+");
				bool flag2 = !match.Success;
				if (flag2)
				{
					result = new OperateResult<string>(operateResult.Content);
				}
				else
				{
					result = OperateResult.CreateSuccessResult<string>(match.Value.Substring(24));
				}
			}
			return result;
		}

		/// <summary>
		/// 获取当前机器人的物理关节点信息，返回json格式的关节信息<br />
		/// Get the physical node information of the current robot and return the joint information in json format
		/// </summary>
		/// <returns>带有关节信息的结果类对象</returns>
		// Token: 0x06000502 RID: 1282 RVA: 0x00014530 File Offset: 0x00012730
		[HslMqttApi(Description = "Get the physical node information of the current robot and return the joint information in json format")]
		public OperateResult<string> GetJointTarget()
		{
			OperateResult<string> operateResult = this.ReadString("url=/rw/motionsystem/mechunits/ROB_1/jointtarget");
			bool flag = !operateResult.IsSuccess;
			OperateResult<string> result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				MatchCollection matchCollection = Regex.Matches(operateResult.Content, "<span class=\"rax[^<]*");
				bool flag2 = matchCollection.Count != 6;
				if (flag2)
				{
					result = new OperateResult<string>(operateResult.Content);
				}
				else
				{
					double[] array = new double[6];
					for (int i = 0; i < matchCollection.Count; i++)
					{
						bool flag3 = matchCollection[i].Length > 17;
						if (flag3)
						{
							array[i] = double.Parse(matchCollection[i].Value.Substring(20));
						}
					}
					result = OperateResult.CreateSuccessResult<string>(JArray.FromObject(array).ToString(0, new JsonConverter[0]));
				}
			}
			return result;
		}

		/// <summary>
		/// 获取当前机器人的速度配比信息<br />
		/// Get the speed matching information of the current robot
		/// </summary>
		/// <returns>带有速度信息的结果类对象</returns>
		// Token: 0x06000503 RID: 1283 RVA: 0x00014608 File Offset: 0x00012808
		[HslMqttApi(Description = "Get the speed matching information of the current robot")]
		public OperateResult<string> GetSpeedRatio()
		{
			OperateResult<string> operateResult = this.ReadString("url=/rw/panel/speedratio");
			bool flag = !operateResult.IsSuccess;
			OperateResult<string> result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				Match match = Regex.Match(operateResult.Content, "<span class=\"speedratio\">[^<]*");
				bool flag2 = !match.Success;
				if (flag2)
				{
					result = new OperateResult<string>(operateResult.Content);
				}
				else
				{
					result = OperateResult.CreateSuccessResult<string>(match.Value.Substring(25));
				}
			}
			return result;
		}

		/// <summary>
		/// 获取当前机器人的工作模式<br />
		/// Gets the current working mode of the robot
		/// </summary>
		/// <returns>带有工作模式信息的结果类对象</returns>
		// Token: 0x06000504 RID: 1284 RVA: 0x00014678 File Offset: 0x00012878
		[HslMqttApi(Description = "Gets the current working mode of the robot")]
		public OperateResult<string> GetOperationMode()
		{
			OperateResult<string> operateResult = this.ReadString("url=/rw/panel/opmode");
			bool flag = !operateResult.IsSuccess;
			OperateResult<string> result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				Match match = Regex.Match(operateResult.Content, "<span class=\"opmode\">[^<]*");
				bool flag2 = !match.Success;
				if (flag2)
				{
					result = new OperateResult<string>(operateResult.Content);
				}
				else
				{
					result = OperateResult.CreateSuccessResult<string>(match.Value.Substring(21));
				}
			}
			return result;
		}

		/// <summary>
		/// 获取当前机器人的本机的输入IO<br />
		/// Gets the input IO of the current robot's native
		/// </summary>
		/// <returns>带有IO信息的结果类对象</returns>
		// Token: 0x06000505 RID: 1285 RVA: 0x000146E8 File Offset: 0x000128E8
		[HslMqttApi(Description = "Gets the input IO of the current robot's native")]
		public OperateResult<string> GetIOIn()
		{
			OperateResult<string> operateResult = this.ReadString("url=/rw/iosystem/devices/D652_10");
			bool flag = !operateResult.IsSuccess;
			OperateResult<string> result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				Match match = Regex.Match(operateResult.Content, "<span class=\"indata\">[^<]*");
				bool flag2 = !match.Success;
				if (flag2)
				{
					result = new OperateResult<string>(operateResult.Content);
				}
				else
				{
					result = OperateResult.CreateSuccessResult<string>(match.Value.Substring(21));
				}
			}
			return result;
		}

		/// <summary>
		/// 获取当前机器人的本机的输出IO<br />
		/// Gets the output IO of the current robot's native
		/// </summary>
		/// <returns>带有IO信息的结果类对象</returns>
		// Token: 0x06000506 RID: 1286 RVA: 0x00014758 File Offset: 0x00012958
		[HslMqttApi(Description = "Gets the output IO of the current robot's native")]
		public OperateResult<string> GetIOOut()
		{
			OperateResult<string> operateResult = this.ReadString("url=/rw/iosystem/devices/D652_10");
			bool flag = !operateResult.IsSuccess;
			OperateResult<string> result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				Match match = Regex.Match(operateResult.Content, "<span class=\"outdata\">[^<]*");
				bool flag2 = !match.Success;
				if (flag2)
				{
					result = new OperateResult<string>(operateResult.Content);
				}
				else
				{
					result = OperateResult.CreateSuccessResult<string>(match.Value.Substring(22));
				}
			}
			return result;
		}

		/// <inheritdoc cref="M:HslCommunication.Robot.ABB.ABBWebApiClient.GetIOIn" />
		// Token: 0x06000507 RID: 1287 RVA: 0x000147C8 File Offset: 0x000129C8
		[HslMqttApi(Description = "Gets the input IO2 of the current robot's native")]
		public OperateResult<string> GetIO2In()
		{
			OperateResult<string> operateResult = this.ReadString("url=/rw/iosystem/devices/BK5250");
			bool flag = !operateResult.IsSuccess;
			OperateResult<string> result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				Match match = Regex.Match(operateResult.Content, "<span class=\"indata\">[^<]*");
				bool flag2 = !match.Success;
				if (flag2)
				{
					result = new OperateResult<string>(operateResult.Content);
				}
				else
				{
					result = OperateResult.CreateSuccessResult<string>(match.Value.Substring(21));
				}
			}
			return result;
		}

		/// <inheritdoc cref="M:HslCommunication.Robot.ABB.ABBWebApiClient.GetIOOut" />
		// Token: 0x06000508 RID: 1288 RVA: 0x00014838 File Offset: 0x00012A38
		[HslMqttApi(Description = "Gets the output IO2 of the current robot's native")]
		public OperateResult<string> GetIO2Out()
		{
			OperateResult<string> operateResult = this.ReadString("url=/rw/iosystem/devices/BK5250");
			bool flag = !operateResult.IsSuccess;
			OperateResult<string> result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				Match match = Regex.Match(operateResult.Content, "<span class=\"outdata\">[^<]*");
				bool flag2 = !match.Success;
				if (flag2)
				{
					result = new OperateResult<string>(operateResult.Content);
				}
				else
				{
					result = OperateResult.CreateSuccessResult<string>(match.Value.Substring(22));
				}
			}
			return result;
		}

		/// <summary>
		/// 获取当前机器人的日志记录，默认记录为10条<br />
		/// Gets the log record for the current robot, which is 10 by default
		/// </summary>
		/// <param name="logCount">读取的最大的日志总数</param>
		/// <returns>带有IO信息的结果类对象</returns>
		// Token: 0x06000509 RID: 1289 RVA: 0x000148A8 File Offset: 0x00012AA8
		[HslMqttApi(Description = "Gets the log record for the current robot, which is 10 by default")]
		public OperateResult<string> GetLog(int logCount = 10)
		{
			OperateResult<string> operateResult = this.ReadString("url=/rw/elog/0?lang=zh&amp;resource=title");
			bool flag = !operateResult.IsSuccess;
			OperateResult<string> result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				MatchCollection matchCollection = Regex.Matches(operateResult.Content, "<li class=\"elog-message-li\" title=\"/rw/elog/0/[0-9]+\">[\\S\\s]+?</li>");
				JArray jarray = new JArray();
				for (int i = 0; i < matchCollection.Count; i++)
				{
					bool flag2 = i >= logCount;
					if (flag2)
					{
						break;
					}
					Match match = Regex.Match(matchCollection[i].Value, "[0-9]+\"");
					JObject jobject = new JObject();
					jobject["id"] = match.Value.TrimEnd(new char[]
					{
						'"'
					});
					foreach (XElement xelement in XElement.Parse(matchCollection[i].Value).Elements("span"))
					{
						jobject[xelement.Attribute("class").Value] = xelement.Value;
					}
					jarray.Add(jobject);
				}
				result = OperateResult.CreateSuccessResult<string>(jarray.ToString());
			}
			return result;
		}

		/// <summary>
		/// 获取当前机器人的系统信息，版本号，唯一ID等信息<br />
		/// Get the current robot's system information, version number, unique ID and other information
		/// </summary>
		/// <returns>系统的基本信息</returns>
		// Token: 0x0600050A RID: 1290 RVA: 0x00014A10 File Offset: 0x00012C10
		[HslMqttApi(Description = "Get the current robot's system information, version number, unique ID and other information")]
		public OperateResult<string> GetSystem()
		{
			OperateResult<string> operateResult = this.ReadString("url=/rw/system");
			bool flag = !operateResult.IsSuccess;
			OperateResult<string> result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				result = this.AnalysisSystem(operateResult.Content);
			}
			return result;
		}

		/// <summary>
		/// 获取当前机器人的系统信息，版本号，唯一ID等信息<br />
		/// Get the current robot's system information, version number, unique ID and other information
		/// </summary>
		/// <returns>系统的基本信息</returns>
		// Token: 0x0600050B RID: 1291 RVA: 0x00014A4C File Offset: 0x00012C4C
		[HslMqttApi(Description = "Get the current robot's system information, version number, unique ID and other information")]
		public OperateResult<string> GetRobotTarget()
		{
			OperateResult<string> operateResult = this.ReadString("url=/rw/motionsystem/mechunits/ROB_1/robtarget");
			bool flag = !operateResult.IsSuccess;
			OperateResult<string> result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				result = this.AnalysisRobotTarget(operateResult.Content);
			}
			return result;
		}

		/// <summary>
		/// 获取当前机器人的伺服使能状态<br />
		/// Get the current robot servo enable state
		/// </summary>
		/// <returns>机器人的伺服使能状态</returns>
		// Token: 0x0600050C RID: 1292 RVA: 0x00014A88 File Offset: 0x00012C88
		[HslMqttApi(Description = "Get the current robot servo enable state")]
		public OperateResult<string> GetServoEnable()
		{
			OperateResult<string> operateResult = this.ReadString("url=/rw/iosystem/signals/Local/DRV_1/DRV1K1");
			bool flag = !operateResult.IsSuccess;
			OperateResult<string> result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				Match match = Regex.Match(operateResult.Content, "<li class=\"ios-signal\"[\\S\\s]+?</li>");
				bool flag2 = !match.Success;
				if (flag2)
				{
					result = new OperateResult<string>(operateResult.Content);
				}
				else
				{
					JObject jobject = new JObject();
					foreach (XElement xelement in XElement.Parse(match.Value).Elements("span"))
					{
						jobject[xelement.Attribute("class").Value] = xelement.Value;
					}
					result = OperateResult.CreateSuccessResult<string>(jobject.ToString());
				}
			}
			return result;
		}

		/// <summary>
		/// 获取当前机器人的当前程序运行状态<br />
		/// Get the current program running status of the current robot
		/// </summary>
		/// <returns>机器人的当前的程序运行状态</returns>
		// Token: 0x0600050D RID: 1293 RVA: 0x00014B80 File Offset: 0x00012D80
		[HslMqttApi(Description = "Get the current program running status of the current robot")]
		public OperateResult<string> GetRapidExecution()
		{
			OperateResult<string> operateResult = this.ReadString("url=/rw/rapid/execution");
			bool flag = !operateResult.IsSuccess;
			OperateResult<string> result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				Match match = Regex.Match(operateResult.Content, "<li class=\"rap-execution\"[\\S\\s]+?</li>");
				bool flag2 = !match.Success;
				if (flag2)
				{
					result = new OperateResult<string>(operateResult.Content);
				}
				else
				{
					JObject jobject = new JObject();
					foreach (XElement xelement in XElement.Parse(match.Value).Elements("span"))
					{
						jobject[xelement.Attribute("class").Value] = xelement.Value;
					}
					result = OperateResult.CreateSuccessResult<string>(jobject.ToString());
				}
			}
			return result;
		}

		/// <summary>
		/// 获取当前机器人的任务列表<br />
		/// Get the task list of the current robot
		/// </summary>
		/// <returns>任务信息的列表</returns>
		// Token: 0x0600050E RID: 1294 RVA: 0x00014C78 File Offset: 0x00012E78
		[HslMqttApi(Description = "Get the task list of the current robot")]
		public OperateResult<string> GetRapidTasks()
		{
			OperateResult<string> operateResult = this.ReadString("url=/rw/rapid/tasks");
			bool flag = !operateResult.IsSuccess;
			OperateResult<string> result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				MatchCollection matchCollection = Regex.Matches(operateResult.Content, "<li class=\"rap-task-li\" [\\S\\s]+?</li>");
				JArray jarray = new JArray();
				for (int i = 0; i < matchCollection.Count; i++)
				{
					JObject jobject = new JObject();
					foreach (XElement xelement in XElement.Parse(matchCollection[i].Value).Elements("span"))
					{
						jobject[xelement.Attribute("class").Value] = xelement.Value;
					}
					jarray.Add(jobject);
				}
				result = OperateResult.CreateSuccessResult<string>(jarray.ToString());
			}
			return result;
		}

		/// <inheritdoc cref="M:HslCommunication.Robot.ABB.ABBWebApiClient.GetCtrlState" />
		// Token: 0x0600050F RID: 1295 RVA: 0x00014D8C File Offset: 0x00012F8C
		[DebuggerStepThrough]
		public Task<OperateResult<string>> GetCtrlStateAsync()
		{
			ABBWebApiClient.<GetCtrlStateAsync>d__28 <GetCtrlStateAsync>d__ = new ABBWebApiClient.<GetCtrlStateAsync>d__28();
			<GetCtrlStateAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string>>.Create();
			<GetCtrlStateAsync>d__.<>4__this = this;
			<GetCtrlStateAsync>d__.<>1__state = -1;
			<GetCtrlStateAsync>d__.<>t__builder.Start<ABBWebApiClient.<GetCtrlStateAsync>d__28>(ref <GetCtrlStateAsync>d__);
			return <GetCtrlStateAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Robot.ABB.ABBWebApiClient.GetErrorState" />
		// Token: 0x06000510 RID: 1296 RVA: 0x00014DD0 File Offset: 0x00012FD0
		[DebuggerStepThrough]
		public Task<OperateResult<string>> GetErrorStateAsync()
		{
			ABBWebApiClient.<GetErrorStateAsync>d__29 <GetErrorStateAsync>d__ = new ABBWebApiClient.<GetErrorStateAsync>d__29();
			<GetErrorStateAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string>>.Create();
			<GetErrorStateAsync>d__.<>4__this = this;
			<GetErrorStateAsync>d__.<>1__state = -1;
			<GetErrorStateAsync>d__.<>t__builder.Start<ABBWebApiClient.<GetErrorStateAsync>d__29>(ref <GetErrorStateAsync>d__);
			return <GetErrorStateAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Robot.ABB.ABBWebApiClient.GetJointTarget" />
		// Token: 0x06000511 RID: 1297 RVA: 0x00014E14 File Offset: 0x00013014
		[DebuggerStepThrough]
		public Task<OperateResult<string>> GetJointTargetAsync()
		{
			ABBWebApiClient.<GetJointTargetAsync>d__30 <GetJointTargetAsync>d__ = new ABBWebApiClient.<GetJointTargetAsync>d__30();
			<GetJointTargetAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string>>.Create();
			<GetJointTargetAsync>d__.<>4__this = this;
			<GetJointTargetAsync>d__.<>1__state = -1;
			<GetJointTargetAsync>d__.<>t__builder.Start<ABBWebApiClient.<GetJointTargetAsync>d__30>(ref <GetJointTargetAsync>d__);
			return <GetJointTargetAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Robot.ABB.ABBWebApiClient.GetSpeedRatio" />
		// Token: 0x06000512 RID: 1298 RVA: 0x00014E58 File Offset: 0x00013058
		[DebuggerStepThrough]
		public Task<OperateResult<string>> GetSpeedRatioAsync()
		{
			ABBWebApiClient.<GetSpeedRatioAsync>d__31 <GetSpeedRatioAsync>d__ = new ABBWebApiClient.<GetSpeedRatioAsync>d__31();
			<GetSpeedRatioAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string>>.Create();
			<GetSpeedRatioAsync>d__.<>4__this = this;
			<GetSpeedRatioAsync>d__.<>1__state = -1;
			<GetSpeedRatioAsync>d__.<>t__builder.Start<ABBWebApiClient.<GetSpeedRatioAsync>d__31>(ref <GetSpeedRatioAsync>d__);
			return <GetSpeedRatioAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Robot.ABB.ABBWebApiClient.GetOperationMode" />
		// Token: 0x06000513 RID: 1299 RVA: 0x00014E9C File Offset: 0x0001309C
		[DebuggerStepThrough]
		public Task<OperateResult<string>> GetOperationModeAsync()
		{
			ABBWebApiClient.<GetOperationModeAsync>d__32 <GetOperationModeAsync>d__ = new ABBWebApiClient.<GetOperationModeAsync>d__32();
			<GetOperationModeAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string>>.Create();
			<GetOperationModeAsync>d__.<>4__this = this;
			<GetOperationModeAsync>d__.<>1__state = -1;
			<GetOperationModeAsync>d__.<>t__builder.Start<ABBWebApiClient.<GetOperationModeAsync>d__32>(ref <GetOperationModeAsync>d__);
			return <GetOperationModeAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Robot.ABB.ABBWebApiClient.GetIOIn" />
		// Token: 0x06000514 RID: 1300 RVA: 0x00014EE0 File Offset: 0x000130E0
		[DebuggerStepThrough]
		public Task<OperateResult<string>> GetIOInAsync()
		{
			ABBWebApiClient.<GetIOInAsync>d__33 <GetIOInAsync>d__ = new ABBWebApiClient.<GetIOInAsync>d__33();
			<GetIOInAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string>>.Create();
			<GetIOInAsync>d__.<>4__this = this;
			<GetIOInAsync>d__.<>1__state = -1;
			<GetIOInAsync>d__.<>t__builder.Start<ABBWebApiClient.<GetIOInAsync>d__33>(ref <GetIOInAsync>d__);
			return <GetIOInAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Robot.ABB.ABBWebApiClient.GetIOOut" />
		// Token: 0x06000515 RID: 1301 RVA: 0x00014F24 File Offset: 0x00013124
		[DebuggerStepThrough]
		public Task<OperateResult<string>> GetIOOutAsync()
		{
			ABBWebApiClient.<GetIOOutAsync>d__34 <GetIOOutAsync>d__ = new ABBWebApiClient.<GetIOOutAsync>d__34();
			<GetIOOutAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string>>.Create();
			<GetIOOutAsync>d__.<>4__this = this;
			<GetIOOutAsync>d__.<>1__state = -1;
			<GetIOOutAsync>d__.<>t__builder.Start<ABBWebApiClient.<GetIOOutAsync>d__34>(ref <GetIOOutAsync>d__);
			return <GetIOOutAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Robot.ABB.ABBWebApiClient.GetIOIn" />
		// Token: 0x06000516 RID: 1302 RVA: 0x00014F68 File Offset: 0x00013168
		[DebuggerStepThrough]
		public Task<OperateResult<string>> GetIO2InAsync()
		{
			ABBWebApiClient.<GetIO2InAsync>d__35 <GetIO2InAsync>d__ = new ABBWebApiClient.<GetIO2InAsync>d__35();
			<GetIO2InAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string>>.Create();
			<GetIO2InAsync>d__.<>4__this = this;
			<GetIO2InAsync>d__.<>1__state = -1;
			<GetIO2InAsync>d__.<>t__builder.Start<ABBWebApiClient.<GetIO2InAsync>d__35>(ref <GetIO2InAsync>d__);
			return <GetIO2InAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Robot.ABB.ABBWebApiClient.GetIOOut" />
		// Token: 0x06000517 RID: 1303 RVA: 0x00014FAC File Offset: 0x000131AC
		[DebuggerStepThrough]
		public Task<OperateResult<string>> GetIO2OutAsync()
		{
			ABBWebApiClient.<GetIO2OutAsync>d__36 <GetIO2OutAsync>d__ = new ABBWebApiClient.<GetIO2OutAsync>d__36();
			<GetIO2OutAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string>>.Create();
			<GetIO2OutAsync>d__.<>4__this = this;
			<GetIO2OutAsync>d__.<>1__state = -1;
			<GetIO2OutAsync>d__.<>t__builder.Start<ABBWebApiClient.<GetIO2OutAsync>d__36>(ref <GetIO2OutAsync>d__);
			return <GetIO2OutAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Robot.ABB.ABBWebApiClient.GetLog(System.Int32)" />
		// Token: 0x06000518 RID: 1304 RVA: 0x00014FF0 File Offset: 0x000131F0
		[DebuggerStepThrough]
		public Task<OperateResult<string>> GetLogAsync(int logCount = 10)
		{
			ABBWebApiClient.<GetLogAsync>d__37 <GetLogAsync>d__ = new ABBWebApiClient.<GetLogAsync>d__37();
			<GetLogAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string>>.Create();
			<GetLogAsync>d__.<>4__this = this;
			<GetLogAsync>d__.logCount = logCount;
			<GetLogAsync>d__.<>1__state = -1;
			<GetLogAsync>d__.<>t__builder.Start<ABBWebApiClient.<GetLogAsync>d__37>(ref <GetLogAsync>d__);
			return <GetLogAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Robot.ABB.ABBWebApiClient.GetSystem" />
		// Token: 0x06000519 RID: 1305 RVA: 0x0001503C File Offset: 0x0001323C
		[DebuggerStepThrough]
		public Task<OperateResult<string>> GetSystemAsync()
		{
			ABBWebApiClient.<GetSystemAsync>d__38 <GetSystemAsync>d__ = new ABBWebApiClient.<GetSystemAsync>d__38();
			<GetSystemAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string>>.Create();
			<GetSystemAsync>d__.<>4__this = this;
			<GetSystemAsync>d__.<>1__state = -1;
			<GetSystemAsync>d__.<>t__builder.Start<ABBWebApiClient.<GetSystemAsync>d__38>(ref <GetSystemAsync>d__);
			return <GetSystemAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Robot.ABB.ABBWebApiClient.GetRobotTarget" />
		// Token: 0x0600051A RID: 1306 RVA: 0x00015080 File Offset: 0x00013280
		[DebuggerStepThrough]
		public Task<OperateResult<string>> GetRobotTargetAsync()
		{
			ABBWebApiClient.<GetRobotTargetAsync>d__39 <GetRobotTargetAsync>d__ = new ABBWebApiClient.<GetRobotTargetAsync>d__39();
			<GetRobotTargetAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string>>.Create();
			<GetRobotTargetAsync>d__.<>4__this = this;
			<GetRobotTargetAsync>d__.<>1__state = -1;
			<GetRobotTargetAsync>d__.<>t__builder.Start<ABBWebApiClient.<GetRobotTargetAsync>d__39>(ref <GetRobotTargetAsync>d__);
			return <GetRobotTargetAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Robot.ABB.ABBWebApiClient.GetServoEnable" />
		// Token: 0x0600051B RID: 1307 RVA: 0x000150C4 File Offset: 0x000132C4
		[DebuggerStepThrough]
		public Task<OperateResult<string>> GetServoEnableAsync()
		{
			ABBWebApiClient.<GetServoEnableAsync>d__40 <GetServoEnableAsync>d__ = new ABBWebApiClient.<GetServoEnableAsync>d__40();
			<GetServoEnableAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string>>.Create();
			<GetServoEnableAsync>d__.<>4__this = this;
			<GetServoEnableAsync>d__.<>1__state = -1;
			<GetServoEnableAsync>d__.<>t__builder.Start<ABBWebApiClient.<GetServoEnableAsync>d__40>(ref <GetServoEnableAsync>d__);
			return <GetServoEnableAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Robot.ABB.ABBWebApiClient.GetRapidExecution" />
		// Token: 0x0600051C RID: 1308 RVA: 0x00015108 File Offset: 0x00013308
		[DebuggerStepThrough]
		public Task<OperateResult<string>> GetRapidExecutionAsync()
		{
			ABBWebApiClient.<GetRapidExecutionAsync>d__41 <GetRapidExecutionAsync>d__ = new ABBWebApiClient.<GetRapidExecutionAsync>d__41();
			<GetRapidExecutionAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string>>.Create();
			<GetRapidExecutionAsync>d__.<>4__this = this;
			<GetRapidExecutionAsync>d__.<>1__state = -1;
			<GetRapidExecutionAsync>d__.<>t__builder.Start<ABBWebApiClient.<GetRapidExecutionAsync>d__41>(ref <GetRapidExecutionAsync>d__);
			return <GetRapidExecutionAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Robot.ABB.ABBWebApiClient.GetRapidTasks" />
		// Token: 0x0600051D RID: 1309 RVA: 0x0001514C File Offset: 0x0001334C
		[DebuggerStepThrough]
		public Task<OperateResult<string>> GetRapidTasksAsync()
		{
			ABBWebApiClient.<GetRapidTasksAsync>d__42 <GetRapidTasksAsync>d__ = new ABBWebApiClient.<GetRapidTasksAsync>d__42();
			<GetRapidTasksAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string>>.Create();
			<GetRapidTasksAsync>d__.<>4__this = this;
			<GetRapidTasksAsync>d__.<>1__state = -1;
			<GetRapidTasksAsync>d__.<>t__builder.Start<ABBWebApiClient.<GetRapidTasksAsync>d__42>(ref <GetRapidTasksAsync>d__);
			return <GetRapidTasksAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x0600051E RID: 1310 RVA: 0x00015190 File Offset: 0x00013390
		public override string ToString()
		{
			return string.Format("ABBWebApiClient[{0}:{1}]", base.IpAddress, base.Port);
		}
	}
}
